home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
utility
/
264
/
man
/
expr.man
< prev
next >
Wrap
Text File
|
1988-06-17
|
2KB
|
67 lines
EXPR ST-UNIX User's Manual EXPR
COMMAND
expr - evaluate arguments as an expression
FORMAT
expr arg...
DESCRIPTION
The arguments which must be separated by whitwe space are
taken as an expression to be evaluated. The result is writ-
ten on the standard output. The operators are listed below
in order of increasing precedence, parentheses may be used
for grouping but must be separate tokens.
_✓e_✓x_✓p_✓r | _✓e_✓x_✓p_✓r
yields the first _✓e_✓x_✓p_✓r if it is neither null nor `0',
otherwise yields the second _✓e_✓x_✓p_✓r.
_✓e_✓x_✓p_✓r & _✓e_✓x_✓p_✓r
yields the first _✓e_✓x_✓p_✓r if neither _✓e_✓x_✓p_✓r is null or `0',
otherwise yields `0'.
_✓e_✓x_✓p_✓r _✓r_✓e_✓l_✓o_✓p _✓e_✓x_✓p_✓r
where _✓r_✓e_✓l_✓o_✓p is one of < <= = != >= >, yields `1' if the
comparison is true, `0' if false. If both _✓e_✓x_✓p_✓r are
integers then the comparison is numeric, otherwise it
is alphabetic.
_✓e_✓x_✓p_✓r + _✓e_✓x_✓p_✓r
_✓e_✓x_✓p_✓r - _✓e_✓x_✓p_✓r
addition or subtraction of the arguments.
_✓e_✓x_✓p_✓r * _✓e_✓x_✓p_✓r
_✓e_✓x_✓p_✓r / _✓e_✓x_✓p_✓r
_✓e_✓x_✓p_✓r % _✓e_✓x_✓p_✓r
multiplication, division, or remainder of the argu-
ments.
( _✓e_✓x_✓p_✓r )
parentheses for grouping.
Examples:
To add 5 to the Shell variable _✓b:
b=`expr $b + 5`
_✓e_✓x_✓p_✓r returns 0 if the neither expression is null or '0', 1
if the either expression is null or '0', 2 for invalid argu-
ments.
Printed 28/March/1988 30 March 1987 1